//
// Created by fazhehy on 2024/3/22.
//

#ifndef PROTOCOL_H
#define PROTOCOL_H

#include "hy_common_inc.h"

struct Remote {
    uint8_t * transmitBuffer;
    uint8_t * receiveBuffer;
    uint8_t transmitBufferLen;
    uint8_t receiveBufferLen;
    uint32_t medAdcValue1;
    uint32_t medAdcValue2;
    uint8_t protocolType;
    uint8_t protocolState;
    uint8_t operation;
    uint16_t adcValue1;
    uint16_t adcValue2;
};

extern struct Remote remote;

void protocol_init();
bool protocol_check();
void protocol_send_command(uint8_t keyNum, uint16_t adcValue1, uint16_t adcValue2);
void protocol_send_data(const uint8_t * buf, uint8_t len);
void protocol_analysis();
uint8_t protocol_printf(const char * format, ...);

#endif //PROTOCOL_H
